package b1.conifg
{
	public class MagicConfig
	{
		//魔法索引
		public var index:int;
		//魔法名字
		public var name:String;
		//图标
		public var iconName:String;
		//自身动画
		public var selfMovie:String;
		//自身动画延迟
		public var selfMovieDelay:int;
		//自身动画帧率
		public var selfMovieFps:int;
		//自身动画宽度
		public var selfMovieWidth:Number;
		//自身动画高度
		public var selfMovieHeight:Number;
		//自身动画位置X
		public var selfMoviePosX:Number;
		//自身动画位置Y
		public var selfMoviePosY:Number;
		//自身动画透明
		public var selfMovieAlpha:Number;
		//对象动画
		public var targetMovie:String;
		//对象动画延迟
		public var targetMovieDelay:int;
		//对象动画帧率
		public var targetMovieFps:int;
		//对象动画宽度
		public var targetMovieWidth:Number;
		//对象动画高度
		public var targetMovieHeight:Number;
		//对象动画位置X
		public var targetMoviePosX:Number;
		//对象动画位置Y
		public var targetMoviePosY:Number;
		//对象动画透明
		public var targetMovieAlpha:Number;
		//天空颜色
		public var skyColor:String;
		//消耗体力
		public var vitalityCost:Array;
		//冷却时间
		public var cooldown:Array;
		//其他数据（攻击值）
		public var bonusData1:Array;
		//自身状态索引
		public var selfStatusIndex:int;
		//自身状态延迟
		public var selfStatusDelay:Number;
		//自身生命值变化
		public var selfStatusHpChange:Array;
		//自身生命值变化重复次数
		public var selfStatusHpChangeIteration:Array;
		//自身体力值变化
		public var selfStatusVpChange:Array;
		//自身体力值变化重复次数
		public var selfStatusVpChangeIteration:Array;
		//对象状态索引
		public var targetStatusIndex:int;
		//对象状态延迟
		public var targetStatusDelay:Number;
		//对象生命值变化
		public var targetStatusHpChange:Array;
		//对象生命值变化重复次数
		public var targetStatusHpChangeIteration:Array;
		//对象体力值变化
		public var targetStatusVpChange:Array;
		//对象体力值变化重复次数
		public var targetStatusVpChangeIteration:Array;
		//召唤动物的索引
		public var summonAnimalIndex:int;
		//召唤动物延迟
		public var summonAnimalDelay:Number;
		//召唤动物持续时间
		public var summonAnimalDuration:Array;
		//召唤动物的高度
		public var summonAnimalHeight:Array;
		//召唤动物的生命值
		public var summonAnimalHp:Array;
		//召唤动物的体力值
		public var summonAnimalVp:Array;
		//召唤动物的速度
		public var summonAnimalSpeed:Array;
		//召唤动物的位置X
		public var summonAnimalPosX:Number;
		//召唤动物的位置Y
		public var summonAnimalPosY:Number;
		//盾牌的索引
		public var shieldIndex:int;
		//盾牌的持续时间
		public var shieldDuration:Array;
		//自定义参数
		public var userData1:Array;
		 //状态持续时间
		public var statusCoolDownTime:int;
		 
		public function MagicConfig(magicXML:XML)
		{
			name = magicXML.name;
			iconName = magicXML.iconName;
			index = parseInt(magicXML.index);
			selfMovie = magicXML.selfMovie;
			selfMovieDelay = parseInt(magicXML.selfMovieDelay);
			selfMovieFps = parseInt(magicXML.selfMovieFps);
			selfMovieWidth = parseFloat(magicXML.selfMovieWidth);
			selfMovieHeight = parseFloat(magicXML.selfMovieHeight);
			selfMoviePosX = parseFloat(magicXML.selfMoviePosX);
			selfMoviePosY = parseFloat(magicXML.selfMoviePosY);
			selfMovieAlpha = parseFloat(magicXML.selfMovieAlpha);
			targetMovie = magicXML.targetMovie;
			targetMovieDelay = parseInt(magicXML.targetMovieDelay);
			targetMovieFps = parseInt(magicXML.targetMovieFps);
			targetMovieWidth = parseFloat(magicXML.targetMovieWidth);
			targetMovieHeight = parseFloat(magicXML.targetMovieHeight);
			targetMoviePosX = parseFloat(magicXML.targetMoviePosX);
			targetMoviePosY = parseFloat(magicXML.targetMoviePosY);
			targetMovieAlpha = parseFloat(magicXML.targetMovieAlpha);
			skyColor = magicXML.skyColor;
			vitalityCost = new Array();
			try
			{
				this.statusCoolDownTime = parseInt (magicXML.statusCoolDownTime);
			}
			catch (error:Error)
			{
			}
			try
			{
				var vitalityCostStrs:Array = magicXML.vitalityCost.split(",");
				for (var i:int = 0; i < vitalityCostStrs.length; i++)
					vitalityCost.push(parseInt(vitalityCostStrs[i]));
			}
			catch (error:Error)
			{
			}
			cooldown = new Array();
			try
			{
				var cooldownStrs:Array = magicXML.cooldown.split(",");
				for (i = 0; i < cooldownStrs.length; i++)
					cooldown.push(parseInt(cooldownStrs[i]));
			}
			catch (error:Error)
			{
			}
			bonusData1 = new Array();
			try
			{
				var bonusData1Strs:Array = magicXML.bonusData1.split(",");
				for (i = 0; i < bonusData1Strs.length; i++)
					bonusData1.push(parseInt(bonusData1Strs[i]));
			}
			catch (error:Error)
			{
			}
			//解析自身状态信息
			selfStatusIndex = parseInt(magicXML.selfStatusIndex);
			selfStatusDelay = parseFloat(magicXML.selfStatusDelay);
			selfStatusHpChange = new Array();
			try
			{
				var selfStatusHpChangeStrs:Array = magicXML.selfStatusHpChange.split(",");
				for (i = 0; i < selfStatusHpChangeStrs.length; i++)
					selfStatusHpChange.push(parseInt(selfStatusHpChangeStrs[i]));
			}
			catch (error:Error)
			{
			}
			selfStatusHpChangeIteration = new Array();
			try
			{
				var selfStatusHpChangeIterationStrs:Array = magicXML.selfStatusHpChangeIteration.split(",");
				for (i = 0; i < selfStatusHpChangeIterationStrs.length; i++)
					selfStatusHpChangeIteration.push(parseInt(selfStatusHpChangeIterationStrs[i]));
			}
			catch (error:Error)
			{
			}
			selfStatusVpChange = new Array();
			try
			{
				var selfStatusVpChangeStrs:Array = magicXML.selfStatusVpChange.split(",");
				for (i = 0; i < selfStatusVpChangeStrs.length; i++)
					selfStatusVpChange.push(parseInt(selfStatusVpChangeStrs[i]));
			}
			catch (error:Error)
			{
			}
			selfStatusVpChangeIteration = new Array();
			try
			{
				var selfStatusVpChangeIterationStrs:Array = magicXML.selfStatusVpChangeIteration.split(",");
				for (i = 0; i < selfStatusVpChangeIterationStrs.length; i++)
					selfStatusVpChangeIteration.push(parseInt(selfStatusVpChangeIterationStrs[i]));
			}
			catch (error:Error)
			{
			}
			//解析对象状态信息
			targetStatusIndex = parseInt(magicXML.targetStatusIndex);
			targetStatusDelay = parseFloat(magicXML.targetStatusDelay);
			targetStatusHpChange = new Array();
			try
			{
				var targetStatusHpChangeStrs:Array = magicXML.targetStatusHpChange.split(",");
				for (i = 0; i < targetStatusHpChangeStrs.length; i++)
					targetStatusHpChange.push(parseInt(targetStatusHpChangeStrs[i]));
			}
			catch (error:Error)
			{
			}
			targetStatusHpChangeIteration = new Array();
			try
			{
				var targetStatusHpChangeIterationStrs:Array = magicXML.targetStatusHpChangeIteration.split(",");
				for (i = 0; i < targetStatusHpChangeIterationStrs.length; i++)
					targetStatusHpChangeIteration.push(parseInt(targetStatusHpChangeIterationStrs[i]));
			}
			catch (error:Error)
			{
			}
			targetStatusVpChange = new Array();
			try
			{
				var targetStatusVpChangeStrs:Array = magicXML.targetStatusVpChange.split(",");
				for (i = 0; i < targetStatusVpChangeStrs.length; i++)
					targetStatusVpChange.push(parseInt(targetStatusVpChangeStrs[i]));
			}
			catch (error:Error)
			{
			}
			targetStatusVpChangeIteration = new Array();
			try
			{
				var targetStatusVpChangeIterationStrs:Array = magicXML.targetStatusVpChangeIteration.split(",");
				for (i = 0; i < targetStatusVpChangeIterationStrs.length; i++)
					targetStatusVpChangeIteration.push(parseInt(targetStatusVpChangeIterationStrs[i]));
			}
			catch (error:Error)
			{
			}
			//召唤动物信息
			summonAnimalIndex = parseInt(magicXML.summonAnimalIndex);
			summonAnimalDelay = parseFloat(magicXML.summonAnimalDelay);
			summonAnimalPosX = parseFloat(magicXML.summonAnimalPosX);
			summonAnimalPosY = parseFloat(magicXML.summonAnimalPosY);
			summonAnimalDuration = new Array();
			try
			{
				var summonAnimalDurationStrs:Array = magicXML.summonAnimalDuration.split(",");
				for (i = 0; i < summonAnimalDurationStrs.length; i++)
					summonAnimalDuration.push(parseFloat(summonAnimalDurationStrs[i]));
			}
			catch (error:Error)
			{
			}
			summonAnimalHp = new Array();
			try
			{
				var summonAnimalHpStrs:Array = magicXML.summonAnimalHp.split(",");
				for (i = 0; i < summonAnimalHpStrs.length; i++)
					summonAnimalHp.push(parseInt(summonAnimalHpStrs[i]));
			}
			catch (error:Error)
			{
			}
			summonAnimalVp = new Array();
			try
			{
				var summonAnimalVpStrs:Array = magicXML.summonAnimalVp.split(",");
				for (i = 0; i < summonAnimalVpStrs.length; i++)
					summonAnimalVp.push(parseInt(summonAnimalVpStrs[i]));
			}
			catch (error:Error)
			{
			}
			summonAnimalSpeed = new Array();
			try
			{
				var summonAnimalSpeedStrs:Array = magicXML.summonAnimalSpeed.split(",");
				for (i = 0; i < summonAnimalSpeedStrs.length; i++)
					summonAnimalSpeed.push(parseFloat(summonAnimalSpeedStrs[i]));
			}
			catch (error:Error)
			{
			}
			//召唤盾牌信息
			shieldIndex = parseInt(magicXML.shieldIndex);
			shieldDuration = new Array();
			try
			{
				var shieldDurationStrs:Array = magicXML.shieldDuration.split(",");
				for (i = 0; i < shieldDurationStrs.length; i++)
					shieldDuration.push(parseFloat(shieldDurationStrs[i]));
			}
			catch (error:Error)
			{
			}
			//额外定义信息
			userData1 = new Array();
			try
			{
				var userData1Strs:Array = magicXML.userData1.split(",");
				for (i = 0; i < userData1Strs.length; i++)
					userData1.push(parseInt(userData1Strs[i]));
			}
			catch (error:Error)
			{
			}
			
		}

	}
}